<template>
  <div class="card">
    <p>姓名:{{itemObj.name}} <van-tag :type="relt.val">{{itemObj.txt}}</van-tag></p>
    <p>理论成绩:{{itemObj.gradeL}}</p>
    <p>技能成绩:{{itemObj.gradeJ}}</p>
    <p>综合得分:{{(itemObj.gradeL*0.2+itemObj.gradeJ*0.8).toFixed(2)}}</p>
  </div>
</template>
<script>
import { computed } from 'vue';
export default {
  props: {
    itemObj: Object,
  },
  setup(props) {
    const relt = computed(() => {
        return {
          val: props.itemObj.txt=='优秀'?'primary':props.itemObj.txt=='良好'?'success':'danger'
        }
    //   let num = props.itemObj.gradeL*0.2+props.itemObj.gradeJ*0.8;
    //   if (num>=90){
    //     return {
    //       val: 'primary',
    //       text: '优秀'
    //     }
    //   } else if (num>=80){
    //     return {
    //       val: 'success',
    //       text: '良好'
    //     }
    //   } else {
    //     return {
    //       val: 'danger',
    //       text: '末班'
    //     }
    //   }
    })
    return{
       relt 
    }
  }
};
</script>
<style lang="scss" scoped>
.card{
 background: #fff;
 width: calc(100% - 20px);
 margin: 10px auto 0;
 border-radius: 5px;
 padding: 10px;
 box-sizing: border-box;
 p{
   line-height: 30px;
 }
}
</style>

